<template>
<div class="page">
  <ul class="layui-nav kedounav-bg">
	  <li class="layui-nav-item layuinavitem " lay-unselect >
	    <a href="javascript:;">
	      <cite class="citets citets1"><img src="../../assets/logo.png"></cite>
        <span class="btspan">{{this.type == 1?this.title:this.shopName}}引领品牌开启智慧零售</span>
	    </a>

	  </li>
	</ul>
	<ul class="layui-nav layui-layout-right kedounav-bg" lay-filter="layadmin-layout-right">
	  <li class="layui-nav-item layui-hide-xs layuinavitem" >
	  	<a href="javascript:;">
	  	  <cite class="citets">欢迎您,</cite>
	  	</a>
	  </li>
	  <li class="layui-nav-item layuinavitem" lay-unselect style="margin-right: 50px;" @click="logout">
	    <a href="javascript:;">
	      <cite class="citets">{{user}}</cite>
	      <span class="layui-nav-more"></span>
	    </a>
	    <dl class="layui-nav-child">
	      <dd style="text-align: center;color:#ffffff;"><a>退出</a></dd>
	    </dl>
	  </li>
	</ul>
</div>
</template>
<script>
	export default {
	  name:'pagetop',
	  data () {
	    return {
	      user:'',
        title:webtitle,
        type:localStorage.getItem("type"),
        shopName:localStorage.getItem("shopName")
	    }
	  },
	  mounted(){
	  	this.getuser();
	  },
	  methods: {
	  	getuser:function(){
	  		if(localStorage.getItem("token")){
	  		   this.user=localStorage.getItem("user")
	  		}else{
	  		   layer.msg('未登陆，请先登录！');
	  		   this.$router.push({ path:'/login'})
	  		}
	  	},
	  	logout:function(){	//退出登录
		    localStorage.setItem("type",'');
  		    localStorage.setItem("id",'');
  		    localStorage.setItem("user",'');
		  	this.$router.push({ path:'/login'})
		}
	  }
	}
</script>
<style scoped>
	.citets{color:#ffffff;}
	.citets1{font-size:18px;}
	.kedounav-bg .layuinavitem{color:#ffffff;}
	.page{height:60px;width:100%;background-color:#3276df;overflow:hidden;}
  .btspan{color:#fff;display:inline-block;border-left:2px solid #fff;height:40px;line-height:40px;margin:0px 0 0 0px;padding-left:20px;font-size:20px;}
</style>
